<script setup>
import { ref, onMounted, computed } from 'vue'
import {
  UploadFilled,
  Back,
  Document,
  QuestionFilled,
  FolderOpened,
  Search,
} from '@element-plus/icons-vue'
import { uploadFile, get_user_sessions, createSession } from '../api/analysis'
import { getMyDatasets } from '../api/dataset'
import { ElMessage } from 'element-plus'

// 定义组件的props和emits
defineProps({
  // 是否暗黑模式
  isDarkMode: {
    type: Boolean,
    default: false,
  },
})

// 定义事件
const emit = defineEmits(['upload-success', 'back'])

// 选项卡切换状态
const activeTab = ref('direct') // 'direct', 'upload', 'dataset'

// 上传和分析状态
const isAnalyzing = ref(false)

// 数据集相关状态
const datasetList = ref([])
const selectedDataset = ref(null)
const isLoadingDatasets = ref(false)
const datasetSearchKeyword = ref('')

// 上传状态和数据集信息
const isUploadSuccess = ref(false)
const uploadedDataset = ref(null)
const datasetRows = ref(0)
const datasetColumns = ref(0)

// 新增：上传进度状态
const uploadProgress = ref(0)
const currentStep = ref(1) // 1: 上传, 2: 解析, 3: 创建
const uploadSteps = ref([
  { id: 1, name: '上传文件', status: 'pending' }, // pending, active, completed
  { id: 2, name: '解析数据', status: 'pending' },
  { id: 3, name: '创建数据集', status: 'pending' },
])

// 计算环形进度条的stroke-dashoffset
const progressCircumference = 327 // 2 * Math.PI * 52
const progressOffset = computed(() => {
  return progressCircumference - (uploadProgress.value / 100) * progressCircumference
})

// 模拟进度更新
const simulateProgress = () => {
  uploadProgress.value = 0
  currentStep.value = 1

  // 重置步骤状态
  uploadSteps.value.forEach((step) => {
    step.status = 'pending'
  })
  uploadSteps.value[0].status = 'active'

  const progressInterval = setInterval(() => {
    uploadProgress.value += Math.random() * 15 + 5

    if (uploadProgress.value >= 30 && currentStep.value === 1) {
      currentStep.value = 2
      uploadSteps.value[0].status = 'completed'
      uploadSteps.value[1].status = 'active'
    }

    if (uploadProgress.value >= 70 && currentStep.value === 2) {
      currentStep.value = 3
      uploadSteps.value[1].status = 'completed'
      uploadSteps.value[2].status = 'active'
    }

    if (uploadProgress.value >= 100) {
      uploadProgress.value = 100
      uploadSteps.value[2].status = 'completed'
      clearInterval(progressInterval)
    }
  }, 300)

  return progressInterval
}

// 获取用户可访问的数据集列表
const fetchDatasets = async () => {
  try {
    isLoadingDatasets.value = true
    const response = await getMyDatasets({
      search: datasetSearchKeyword.value,
      dataset_type: 0,
    })
    if (response && response.data) {
      datasetList.value = response.data
    }
  } catch (error) {
    ElMessage.error('获取数据集列表失败')
    console.error('获取数据集列表错误:', error)
  } finally {
    isLoadingDatasets.value = false
  }
}

// 搜索数据集
const handleSearchDataset = () => {
  fetchDatasets()
}

// 选择数据集
const handleSelectDataset = (dataset) => {
  selectedDataset.value = dataset
}

// 添加变量保存上传的数据集ID
const uploadedDatasetId = ref(null)

// 直接创建会话的标题
const directSessionTitle = ref('')

// 生成递增的会话标题
const generateSessionTitle = async () => {
  try {
    // 获取现有会话列表
    const sessions = await get_user_sessions()
    if (sessions && Array.isArray(sessions)) {
      // 找出所有以"新会话"开头的会话标题
      const newSessionTitles = sessions
        .map(session => session.session_title || '')
        .filter(title => title.startsWith('新会话'))

      // 提取数字后缀并找到最大值
      let maxNumber = 0
      newSessionTitles.forEach(title => {
        const match = title.match(/^新会话(\d+)$/)
        if (match) {
          const number = parseInt(match[1], 10)
          if (number > maxNumber) {
            maxNumber = number
          }
        }
      })

      // 生成下一个递增的标题
      return `新会话${maxNumber + 1}`
    }
  } catch (error) {
    console.error('获取会话列表失败:', error)
  }

  // 如果获取失败，默认返回"新会话1"
  return '新会话1'
}

// 通过数据集创建会话
const handleCreateSessionByDataset = async () => {
  if (!selectedDataset.value && !uploadedDatasetId.value) {
    ElMessage.warning('请先选择一个数据集')
    return
  }

  try {
    // 通知父组件更新分析状态
    isAnalyzing.value = true

    // 根据当前选项卡使用不同的数据集ID
    const datasetId =
      activeTab.value === 'dataset' ? selectedDataset.value.id : uploadedDatasetId.value

    // 创建会话标题（可选），这里使用数据集名称
    const sessionTitle = activeTab.value === 'dataset' ? selectedDataset.value.name : ''

    // 调用创建会话接口
    const response = await createSession(datasetId, sessionTitle)

    ElMessage.success('会话创建成功')

    if (response && response.success) {
      // 重新获取会话列表
      const sessions = await get_user_sessions()
      if (sessions && Array.isArray(sessions)) {
        const historyDialogs = sessions.map((session) => ({
          id: session.id,
          title: session.session_title || `对话${session.id}`,
          type: 'chat',
          starred: false,
          messages: session.messages || [],
        }))

        // 通知父组件上传成功，并传递会话列表
        emit('upload-success', { historyDialogs })
      }
    }
  } catch (error) {
    ElMessage.error('创建会话失败，请重试')
    console.error('创建会话错误:', error)
  } finally {
    // 通知父组件更新分析状态
    isAnalyzing.value = false
  }
}

// 直接创建会话（不关联数据集）
const handleCreateDirectSession = async () => {
  if (!directSessionTitle.value.trim()) {
    ElMessage.warning('请输入会话标题')
    return
  }

  try {
    // 通知父组件更新分析状态
    isAnalyzing.value = true

    // 调用创建会话接口，不传递数据集ID
    const response = await createSession(null, directSessionTitle.value.trim())

    ElMessage.success('会话创建成功')

    if (response && response.success) {
      // 重新获取会话列表
      const sessions = await get_user_sessions()
      if (sessions && Array.isArray(sessions)) {
        const historyDialogs = sessions.map((session) => ({
          id: session.id,
          title: session.session_title || `对话${session.id}`,
          type: 'chat',
          starred: false,
          messages: session.messages || [],
        }))

        // 通知父组件上传成功，并传递会话列表
        emit('upload-success', { historyDialogs })
      }
    }
  } catch (error) {
    ElMessage.error('创建会话失败，请重试')
    console.error('创建会话错误:', error)
  } finally {
    // 通知父组件更新分析状态
    isAnalyzing.value = false
  }
}

// 处理文件上传成功
const handleUploadSuccess = async ({ file, onSuccess, onError }) => {
  try {
    // 检查文件类型
    const fileType = file.name.split('.').pop().toLowerCase()
    if (!['xlsx', 'xls'].includes(fileType)) {
      ElMessage.error('只支持上传 Excel 文件（.xlsx, .xls）')
      return
    }

    // 检查文件大小（10MB）
    const maxSize = 10 * 1024 * 1024 // 10MB in bytes
    if (file.size > maxSize) {
      ElMessage.error('文件大小不能超过10MB')
      return
    }

    // 通知父组件更新分析状态
    isAnalyzing.value = true

    // 开始模拟进度
    const progressInterval = simulateProgress()

    // 调用上传接口
    const formData = new FormData()
    formData.append('file', file)
    formData.append('datasetname', file.name.split('.')[0]) // 使用文件名作为数据集名称
    formData.append('description', '通过文件上传创建的数据集')

    const response = await uploadFile(formData)
    onSuccess(response)

    if (response.id) {
      // 确保进度完成
      clearInterval(progressInterval)
      uploadProgress.value = 100
      uploadSteps.value.forEach((step) => {
        step.status = 'completed'
      })

      // 延迟一下显示成功状态
      setTimeout(() => {
      // 上传成功提示
      ElMessage.success('文件上传成功，请点击"创建会话"按钮继续')

      // 保存数据集ID供后续创建会话使用
      uploadedDatasetId.value = response.id

      // 保存上传的数据集信息
      uploadedDataset.value = response
      isUploadSuccess.value = true

      // 解析数据集的行数和列数
      try {
        if (response.data_summary_log) {
          const summaryLog = JSON.parse(response.data_summary_log)
          if (summaryLog['基本信息']) {
            datasetRows.value = summaryLog['基本信息']['总行数'] || 0
            datasetColumns.value = summaryLog['基本信息']['总列数'] || 0
          }
        }
      } catch {
        console.error('解析数据集信息出错')
      }

        // 通知父组件更新分析状态
        isAnalyzing.value = false
      }, 1000)
    }
  } catch (error) {
    console.error('文件上传失败:', error)
    ElMessage.error('文件上传失败，请重试')
    if (onError) onError()

    // 通知父组件更新分析状态
    isAnalyzing.value = false
  }
}

// 返回上一页
const handleBack = () => {
  emit('back')
}

// 支持的文件类型
const supportedFileTypes = [{ name: 'Excel文件', extensions: '.xlsx, .xls', icon: 'Document' }]

// 上传提示
const uploadTips = [
  { text: '文件大小不超过10MB' },
  { text: '仅支持Excel格式（.xlsx, .xls）' },
  { text: '第一行必须是列名，第二行开始是数据' },
  { text: '请确保数据表头完整' },
]

// 组件挂载时加载数据集列表和初始化会话标题
onMounted(async () => {
  fetchDatasets()
  // 初始化会话标题
  directSessionTitle.value = await generateSessionTitle()
})
</script>

<template>
  <div class="upload-container">
    <div class="upload-content glass-effect">
      <!-- 分析中状态保持居中显示 -->
      <div v-if="isAnalyzing" class="analyzing-container">
        <div class="upload-progress-card">
          <!-- 环形进度指示器 -->
          <div class="circular-progress">
            <svg class="progress-ring" width="120" height="120">
              <defs>
                <linearGradient id="progressGradient" x1="0%" y1="0%" x2="100%" y2="100%">
                  <stop offset="0%" stop-color="#409EFF" />
                  <stop offset="100%" stop-color="#67C23A" />
                </linearGradient>
              </defs>
              <circle
                class="progress-ring-circle progress-ring-bg"
                stroke="#e6e6e6"
                stroke-width="8"
                fill="transparent"
                r="52"
                cx="60"
                cy="60"
              />
              <circle
                class="progress-ring-circle progress-ring-progress"
                stroke="url(#progressGradient)"
                stroke-width="8"
                fill="transparent"
                r="52"
                cx="60"
                cy="60"
                stroke-linecap="round"
                :style="{ strokeDashoffset: progressOffset }"
              />
            </svg>
            <div class="progress-content">
              <div class="upload-icon-container">
                <el-icon class="upload-icon-animated"><UploadFilled /></el-icon>
              </div>
              <div class="progress-percentage">{{ Math.round(uploadProgress) }}%</div>
            </div>
          </div>

          <!-- 状态文本和动画点 -->
          <div class="status-section">
        <div class="analyzing-animation">
          <div class="circle"></div>
          <div class="circle"></div>
          <div class="circle"></div>
        </div>
            <h3 class="analyzing-title">正在处理您的文件</h3>
            <p class="analyzing-text">数据分析中，请耐心等待...</p>
          </div>

          <!-- 处理步骤指示器 -->
          <div class="processing-steps">
            <div
              v-for="(step, index) in uploadSteps"
              :key="step.id"
              class="step-item"
              :class="{
                active: step.status === 'completed',
                processing: step.status === 'active',
              }"
            >
              <div class="step-icon">
                <el-icon v-if="index === 0"><UploadFilled /></el-icon>
                <el-icon v-else-if="index === 1"><Document /></el-icon>
                <el-icon v-else><FolderOpened /></el-icon>
              </div>
              <div class="step-text">{{ step.name }}</div>
            </div>
            <div
              v-for="(step, index) in uploadSteps.slice(0, -1)"
              :key="`connector-${index}`"
              class="step-connector"
              :class="{ active: uploadSteps[index].status === 'completed' }"
            ></div>
          </div>

          <!-- 温馨提示 -->
          <div class="upload-tips-card">
            <div class="tip-item">
              <el-icon class="tip-icon"><QuestionFilled /></el-icon>
              <span>请保持页面开启，上传过程需要一些时间</span>
            </div>
            <div class="tip-item">
              <el-icon class="tip-icon"><QuestionFilled /></el-icon>
              <span>文件较大时处理时间会相应延长</span>
            </div>
          </div>
        </div>
      </div>

      <!-- 非分析状态使用三行布局 -->
      <div v-else class="upload-layout">
        <!-- 第一行：logo和标题 -->
        <div class="header-row">
          <div class="logo-container">
            <img src="@/assets/logo.svg" alt="析语Datatk" class="logo" />
            <div class="logo-glow"></div>
          </div>
          <div class="divider"></div>
        </div>

        <!-- 第二行：选项卡和内容区域 -->
        <div class="content-row">
          <!-- 选项卡 -->
          <div class="tabs-container">
            <div
              class="tab-item"
              :class="{ active: activeTab === 'direct' }"
              @click="activeTab = 'direct'"
            >
              <el-icon><QuestionFilled /></el-icon>
              <span>直接创建会话</span>
            </div>
            <div
              class="tab-item"
              :class="{ active: activeTab === 'upload' }"
              @click="activeTab = 'upload'"
            >
              <el-icon><UploadFilled /></el-icon>
              <span>上传文件</span>
            </div>
            <div
              class="tab-item"
              :class="{ active: activeTab === 'dataset' }"
              @click="activeTab = 'dataset'"
            >
              <el-icon><FolderOpened /></el-icon>
              <span>选择数据集</span>
            </div>
          </div>

          <!-- 内容区域 -->
          <div class="tabs-content">
            <!-- 直接创建会话选项卡内容 -->
              <div v-if="activeTab === 'direct'" class="direct-session-area">
                <div class="direct-session-inner">

                  <div class="session-content">
                    <h3 class="session-title">直接创建会话</h3>
                    <p class="session-description">
                      您可以直接创建一个新的对话会话，无需关联任何数据集。
                    </p>

                    <!-- 会话标题输入框 -->
                    <div class="session-input-wrapper">
                      <el-input
                        v-model="directSessionTitle"
                        placeholder="请输入会话标题"
                        clearable
                        maxlength="50"
                        show-word-limit
                        size="large"
                        class="session-title-input"
                      >
                        <template #prepend>
                          <span>会话标题</span>
                        </template>
                      </el-input>
                    </div>
                  </div>
                </div>
              </div>

            <!-- 上传文件选项卡内容 -->
            <div v-else-if="activeTab === 'upload'" class="tab-content upload-tab upload-vertical">
              <!-- 上传成功后显示数据集信息 -->
              <div v-if="isUploadSuccess" class="upload-success-info">
                <h3 class="success-title">Excel文件上传成功！</h3>
                <div class="dataset-info-card">
                  <div class="dataset-info-item">
                    <span class="info-label">数据集名称:</span>
                    <span class="info-value">{{ uploadedDataset?.name || '未命名数据集' }}</span>
                  </div>
                  <div class="dataset-info-item">
                    <span class="info-label">总行数:</span>
                    <span class="info-value">{{ datasetRows }}</span>
                  </div>
                  <div class="dataset-info-item">
                    <span class="info-label">总列数:</span>
                    <span class="info-value">{{ datasetColumns }}</span>
                  </div>
                </div>
                <div class="success-tip">请点击下方"创建会话"按钮继续</div>
              </div>

              <!-- 未上传成功时显示上传组件 -->
              <div v-else class="upload-top">
                <el-upload
                  class="upload-area"
                  drag
                  :auto-upload="true"
                  :show-file-list="false"
                  :http-request="handleUploadSuccess"
                  accept=".xlsx,.xls"
                  :before-upload="
                    (file) => {
                      const isExcel = ['xlsx', 'xls'].includes(
                        file.name.split('.').pop().toLowerCase(),
                      )
                      if (!isExcel) {
                        ElMessage.error('只支持上传 Excel 文件（.xlsx, .xls）')
                        return false
                      }
                      return true
                    }
                  "
                >
                  <div class="upload-inner">
                    <el-icon class="upload-icon"><upload-filled /></el-icon>
                    <div class="upload-text"><em>点击上传excel文件</em> 或将文件拖到这里</div>
                    <div class="upload-tips">
                      <div v-for="(tip, index) in uploadTips" :key="index" class="tip-item">
                        <el-icon class="tip-icon"><QuestionFilled /></el-icon>
                        <span>{{ tip.text }}</span>
                      </div>
                    </div>
                    <div class="upload-supported-types" style="display: none">
                      <div
                        v-for="(type, index) in supportedFileTypes"
                        :key="index"
                        class="file-type-item"
                      >
                        <el-icon><Document /></el-icon>
                        <span>{{ type.name }} ({{ type.extensions }})</span>
                      </div>
                    </div>
                  </div>
                </el-upload>
              </div>
            </div>

            <!-- 选择数据集选项卡内容 -->
            <div v-else-if="activeTab === 'dataset'" class="tab-content dataset-tab">
              <div class="dataset-container">
                <div class="dataset-search">
                  <el-input
                    v-model="datasetSearchKeyword"
                    placeholder="搜索数据集..."
                    clearable
                    @keyup.enter="handleSearchDataset"
                    @clear="handleSearchDataset"
                  >
                    <template #prefix>
                      <el-icon><Search /></el-icon>
                    </template>
                    <template #append>
                      <el-button @click="handleSearchDataset">搜索</el-button>
                    </template>
                  </el-input>
                </div>

                <div class="">
                  <el-empty
                    v-if="datasetList.length === 0 && !isLoadingDatasets"
                    description="暂无可用数据集"
                  ></el-empty>
                  <el-skeleton v-else-if="isLoadingDatasets" :rows="5" animated />
                  <div v-else class="dataset-cards">
                    <div
                      v-for="dataset in datasetList"
                      :key="dataset.id"
                      class="dataset-card"
                      :class="{ selected: selectedDataset && selectedDataset.id === dataset.id }"
                      @click="handleSelectDataset(dataset)"
                    >
                      <div class="dataset-icon">
                        <el-icon><Document /></el-icon>
                      </div>
                      <div class="dataset-info">
                        <div class="dataset-name">{{ dataset.name }}</div>
                        <div class="dataset-meta">
                          <span>创建: {{ new Date(dataset.created_at).toLocaleDateString() }}</span>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>

          </div>
        </div>

        <!-- 第三行：按钮区域 -->
        <div class="footer-row">
          <div class="buttons-container">
            <el-button type="primary" @click="handleBack" class="back-btn" size="small">
              <el-icon><Back /></el-icon>
              返回主页
            </el-button>
            <el-button
              v-if="activeTab === 'direct'"
              type="success"
              @click="handleCreateDirectSession"
              size="large"
              class="create-btn"
            >
              直接创建会话
            </el-button>
            <el-button
              v-else
              type="success"
              :disabled="activeTab === 'dataset' ? !selectedDataset : !uploadedDatasetId"
              @click="handleCreateSessionByDataset"
              size="large"
              class="create-btn"
            >
              创建会话
            </el-button>
          </div>

          <div class="help-text" style="display: none">
            <el-icon><QuestionFilled /></el-icon>
            <span>遇到问题？析语助手随时为您服务</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped>
/* 容器样式 */
.upload-container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* 上传成功信息样式 */
.upload-success-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--app-spacing-md);
  padding: var(--app-spacing-xl);
  width: 100%;
}

.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(var(--el-color-success-rgb), 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--app-spacing-md);
}

.success-icon-inner {
  color: var(--el-color-success);
  font-size: 36px;
}

.success-title {
  font-size: var(--app-font-size-lg);
  color: var(--el-color-success);
  margin: 0 0 var(--app-spacing-md);
  font-weight: 600;
}

.dataset-info-card {
  background: var(--app-gradient-card);
  border: 1px solid var(--app-border-color);
  border-radius: var(--app-radius-md);
  padding: var(--app-spacing-lg);
  width: 100%;
  max-width: 400px;
  margin: var(--app-spacing-md) 0;
}

.dataset-info-item {
  display: flex;
  justify-content: space-between;
  padding: var(--app-spacing-sm) 0;
  border-bottom: 1px solid var(--app-border-color);
}

.dataset-info-item:last-child {
  border-bottom: none;
}

.info-label {
  font-weight: 600;
  color: var(--app-text-secondary);
}

.info-value {
  color: var(--app-text-primary);
}

.success-tip {
  font-size: var(--app-font-size-base);
  color: var(--app-text-regular);
  margin-top: var(--app-spacing-md);
}

.glass-effect {
  backdrop-filter: blur(10px);
  border: 1px solid var(--app-border-color);
  box-shadow: var(--app-shadow-card);
  border-radius: var(--app-radius-md);
  transition: var(--app-transition-normal);
  position: relative;
}
.upload-content {
  text-align: center;
  max-width: 900px;
  width: 95%;
  padding: var(--app-spacing-lg);
  position: relative;
  overflow: hidden;
  transition: var(--app-transition-normal);
}

/* 三行布局样式 */
.upload-layout {
  display: flex;
  flex-direction: column;
  gap: var(--app-spacing-sm);
  min-height: 400px;
}

/* 第一行：标题区域 */
.header-row {
  text-align: center;
  padding: var(--app-spacing-sm) 0;
  margin: 0 auto;
  max-width: 600px;
}

/* 选项卡样式 */
.tabs-container {
  display: flex;
  justify-content: center;
  gap: var(--app-spacing-lg);
  margin-bottom: var(--app-spacing-xl);
  padding-bottom: var(--app-spacing-md);
}

.tab-item {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-xs);
  padding: var(--app-spacing-sm) var(--app-spacing-lg);
  border-radius: var(--app-radius-md);
  cursor: pointer;
  transition: var(--app-transition-normal);
  position: relative;
  color: var(--app-text-regular);
}

/* 直接创建会话选项卡样式 - 高端美化版 */
.direct-tab {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
  position: relative;
  overflow: hidden;
}

.direct-tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg,
    rgba(67, 97, 238, 0.03) 0%,
    rgba(64, 158, 255, 0.05) 50%,
    rgba(139, 92, 246, 0.03) 100%);
  border-radius: 24px;
  z-index: 0;
}

/* 直接创建会话样式 - 仿照上传文件风格 */
.direct-session-area {
  width: 100%;
  margin: 0 auto;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08),
              0 4px 16px rgba(0, 0, 0, 0.04);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.direct-session-area::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg,
    rgba(99, 102, 241, 0.02) 0%,
    rgba(168, 85, 247, 0.02) 50%,
    rgba(236, 72, 153, 0.02) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.direct-session-area:hover {
  border-color: #6366f1;
  box-shadow: 0 12px 48px rgba(99, 102, 241, 0.12),
              0 6px 24px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.direct-session-area:hover::before {
  opacity: 1;
}

.direct-session-inner {
  padding: 2rem;
  text-align: center;
  position: relative;
  z-index: 1;
}


.direct-session-area:hover .session-icon {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.4);
}

.direct-session-area:hover .session-icon .el-icon {
  transform: scale(1.1);
}

.session-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 1rem 0;
  letter-spacing: -0.02em;
}

.session-description {
  font-size: 1rem;
  color: #6b7280;
  margin: 0 0 1rem 0;
  line-height: 1.6;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.info-features {
  display: flex;
  flex-direction: column;
  gap: var(--app-spacing-md);
  margin-top: var(--app-spacing-lg);
}

.feature-item {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-sm);
  padding: var(--app-spacing-sm) var(--app-spacing-md);
  background: var(--app-gradient-card);
  border: 1px solid var(--app-border-color);
  border-radius: var(--app-radius-md);
  transition: var(--app-transition-normal);
}

.feature-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--app-shadow-card);
}

.feature-icon {
  color: var(--el-color-primary);
  font-size: 18px;
}

/* 会话输入框样式 */
.session-input-wrapper {
  margin-top: 1rem;
  width: 100%;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.session-title-input :deep(.el-input-group__prepend) {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  font-weight: 600;
  padding: 0 20px;
  border-radius: 8px 0 0 8px;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.session-title-input :deep(.el-input__wrapper) {
  border-radius: 0 8px 8px 0;
  border: 2px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  background: white;
}

.session-title-input :deep(.el-input__wrapper:hover) {
  border-color: #6366f1;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15);
}

.session-title-input :deep(.el-input__wrapper.is-focus) {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1), 0 4px 16px rgba(99, 102, 241, 0.15);
}

.session-title-input :deep(.el-input__inner) {
  font-size: 16px;
  font-weight: 500;
  color: #374151;
  padding: 12px 16px;
  background: transparent;
}

.session-title-input :deep(.el-input__inner::placeholder) {
  color: #9ca3af;
  font-weight: 400;
}

.session-title-input :deep(.el-input__count) {
  color: #6b7280;
  font-size: 0.875rem;
  font-weight: 500;
}

.session-title-input :deep(.el-input__suffix) {
  padding-right: 12px;
}

.tab-item .el-icon {
  font-size: var(--app-font-size-lg);
}

.tab-item:hover {
  color: var(--el-color-primary);
  background-color: rgba(var(--el-color-primary-rgb), 0.05);
}

.tab-item.active {
  color: var(--el-color-primary);
  font-weight: 600;
}

.tab-item.active::after {
  content: '';
  position: absolute;
  bottom: -13px;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--el-color-primary);
  border-radius: var(--app-radius-sm);
}

.tabs-content {
  width: 100%;
  flex: 1;
}

.tab-content {
  display: flex;
  width: 100%;
  height: 100%;
  gap: var(--app-spacing-xl);
}

/* 第二行：内容区域 */
.content-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-direction: column;
  flex: 1;
  position: relative;
}

/* 上传选项卡垂直布局 */
.upload-vertical {
  flex-direction: column !important;
  gap: var(--app-spacing-xl);
}

.upload-top {
  width: 100%;
  margin-bottom: var(--app-spacing-lg);
}

.upload-bottom {
  width: 100%;
  border-top: 1px solid var(--app-border-color);
  padding-top: var(--app-spacing-xl);
  margin-top: var(--app-spacing-md);
}

/* 更新功能卡片网格布局 */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--app-spacing-md);
}

/* 数据集样式 */
.dataset-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--app-spacing-md);
}

.dataset-search {
  margin-bottom: var(--app-spacing-md);
}

.dataset-list {
  height: 400px;
  overflow-y: auto;
  border-radius: var(--app-radius-md);
  background: rgba(255, 255, 255, 0.5);
  padding: var(--app-spacing-md);
  border: 1px solid var(--app-border-color);
  margin-bottom: var(--app-spacing-lg);
}

.dataset-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--app-spacing-md);
}

.dataset-card {
  display: flex;
  align-items: flex-start;
  gap: var(--app-spacing-md);
  padding: var(--app-spacing-md);
  border-radius: var(--app-radius-md);
  background: var(--app-gradient-card);
  border: 1px solid var(--app-border-color);
  cursor: pointer;
  transition: var(--app-transition-normal);
  height: 100%;
}

.dataset-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--app-shadow-light);
  border-color: rgba(var(--el-color-primary-rgb), 0.2);
}

.dataset-card.selected {
  background: rgba(var(--el-color-primary-rgb), 0.08);
  border-color: var(--el-color-primary);
  transform: translateY(-2px);
  box-shadow: var(--app-shadow-light);
}

.dataset-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--app-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--el-color-primary-rgb), 0.1);
  color: var(--el-color-primary);
  font-size: 24px;
  flex-shrink: 0;
}

.dataset-info {
  flex: 1;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dataset-name {
  font-weight: 600;
  font-size: var(--app-font-size-md);
  color: var(--app-text-primary);
  margin-bottom: 2px;
}

.dataset-desc {
  font-size: var(--app-font-size-sm);
  color: var(--app-text-regular);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.dataset-meta {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-md);
  font-size: var(--app-font-size-xs);
  color: var(--app-text-secondary);
}

.dataset-tags {
  background: rgba(var(--el-color-success-rgb), 0.1);
  color: var(--el-color-success);
  padding: 1px 6px;
  border-radius: var(--app-radius-sm);
}

.dataset-action {
  display: flex;
  justify-content: center;
  margin-top: var(--app-spacing-md);
}

.create-btn {
  padding: 12px 24px !important;
  height: auto !important;
  font-size: var(--app-font-size-md) !important;
  font-weight: 600 !important;
  background: linear-gradient(
    135deg,
    var(--el-color-success),
    var(--el-color-success-light-3)
  ) !important;
  border: none !important;
  box-shadow: 0 4px 15px rgba(var(--el-color-success-rgb), 0.2) !important;
  transition: all 0.3s ease !important;
}

.create-btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(var(--el-color-primary-rgb), 0.3) !important;
  background: linear-gradient(
    135deg,
    var(--el-color-primary-light-3),
    var(--el-color-primary)
  ) !important;
}

.create-btn:disabled {
  opacity: 0.7;
  background: linear-gradient(135deg, #909399, #c0c4cc) !important;
  box-shadow: none !important;
}

.dataset-detail-card {
  padding: var(--app-spacing-lg);
  border-radius: var(--app-radius-md);
  background: var(--app-gradient-card);
  border: 1px solid var(--app-border-color);
  text-align: left;
}

.dataset-detail-card h3 {
  margin-top: 0;
  margin-bottom: var(--app-spacing-md);
  padding-bottom: var(--app-spacing-sm);
  border-bottom: 1px solid var(--app-border-color);
  color: var(--app-text-primary);
}

.detail-item {
  display: flex;
  margin-bottom: var(--app-spacing-sm);
}

.detail-label {
  width: 80px;
  font-weight: 600;
  color: var(--app-text-secondary);
  flex-shrink: 0;
}

.detail-value {
  flex: 1;
  color: var(--app-text-regular);
}

.dataset-placeholder {
  height: 100%;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--app-spacing-md);
  color: var(--app-text-secondary);
  background: rgba(245, 247, 250, 0.5);
  border-radius: var(--app-radius-md);
  border: 1px dashed var(--app-border-color);
}

.dataset-placeholder .el-icon {
  font-size: 48px;
  opacity: 0.5;
}

.dataset-placeholder p {
  margin: 0;
}

/* 第三行：底部区域 - 高端美化版 */
.footer-row {
  text-align: center;
  padding: var(--app-spacing-lg) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--app-spacing-md);
  position: relative;
}

.footer-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(67, 97, 238, 0.3) 50%,
    transparent 100%);
}

.buttons-container {
  display: flex;
  justify-content: center;
  gap: var(--app-spacing-lg);
  margin-bottom: var(--app-spacing-sm);
  position: relative;
}

.back-btn,
.create-btn {
  font-size: 1rem !important;
  padding: 12px 36px !important;
  height: auto !important;
  min-width: 140px !important;
  border-radius: 20px !important;
  border: none !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em !important;
  position: relative !important;
  overflow: hidden !important;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.back-btn::before,
.create-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent);
  transition: left 0.6s ease;
}

.back-btn:hover::before,
.create-btn:hover::before {
  left: 100%;
}

/* 返回按钮样式 - 高端蓝色 */
.back-btn {
  background: linear-gradient(135deg,
    #4361ee 0%,
    #409eff 50%,
    #5b73f0 100%) !important;
  box-shadow:
    0 8px 24px rgba(67, 97, 238, 0.25),
    0 4px 12px rgba(67, 97, 238, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
  color: white !important;
}

.back-btn:hover {
  transform: translateY(-3px) scale(1.02) !important;
  box-shadow:
    0 16px 40px rgba(67, 97, 238, 0.35),
    0 8px 20px rgba(67, 97, 238, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
  background: linear-gradient(135deg,
    #5b73f0 0%,
    #4361ee 50%,
    #409eff 100%) !important;
}

.back-btn:active {
  transform: translateY(-1px) scale(1.01) !important;
}

/* 创建会话按钮样式 - 高端渐变 */
.create-btn {
  background: linear-gradient(135deg,
    #10b981 0%,
    #059669 25%,
    #047857 50%,
    #065f46 75%,
    #064e3b 100%) !important;
  box-shadow:
    0 12px 32px rgba(16, 185, 129, 0.3),
    0 6px 16px rgba(16, 185, 129, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
  color: white !important;
  position: relative !important;
}

.create-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 50%,
    rgba(0, 0, 0, 0.1) 100%);
  border-radius: 24px;
  pointer-events: none;
}

.create-btn:hover {
  transform: translateY(-4px) scale(1.05) !important;
  box-shadow:
    0 20px 48px rgba(16, 185, 129, 0.4),
    0 12px 24px rgba(16, 185, 129, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
  background: linear-gradient(135deg,
    #34d399 0%,
    #10b981 25%,
    #059669 50%,
    #047857 75%,
    #065f46 100%) !important;
}

.create-btn:active {
  transform: translateY(-2px) scale(1.03) !important;
}

.back-btn .el-icon,
.create-btn .el-icon {
  margin-right: 10px !important;
  font-size: 1.25rem !important;
  transition: transform 0.3s ease !important;
}

.back-btn:hover .el-icon,
.create-btn:hover .el-icon {
  transform: scale(1.1) !important;
}

.create-btn:disabled {
  opacity: 0.6 !important;
  background: linear-gradient(135deg,
    #9ca3af 0%,
    #6b7280 50%,
    #4b5563 100%) !important;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
  transform: none !important;
  cursor: not-allowed !important;
}

.create-btn:disabled::before,
.create-btn:disabled::after {
  display: none !important;
}

.create-btn:disabled:hover {
  transform: none !important;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.logo-container {
  position: relative;
  width: 320px;
  height: 100px;
  margin: 0;
}

.logo {
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 2;
}

.logo-glow {
  position: absolute;
  width: 120%;
  height: 120%;
  top: -10%;
  left: -10%;
  background: radial-gradient(circle, rgba(64, 158, 255, 0.2) 0%, transparent 70%);
  filter: blur(8px);
  z-index: 1;
  animation: pulse 3s infinite ease-in-out;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.1);
  }
}

@keyframes logo-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.divider {
  height: 1px;
  background: var(--app-gradient-divider);
  margin: var(--app-spacing-sm) auto;
  width: 60%;
  opacity: 0.7;
}

.app-title {
  font-size: var(--app-font-size-xxl);
  margin: var(--app-spacing-md) 0 var(--app-spacing-xs);
  background: var(--app-gradient-title);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 600;
  letter-spacing: var(--app-letter-spacing-tight);
}

.app-desc {
  font-size: var(--app-font-size-base);
  color: var(--app-text-regular);
  margin: var(--app-spacing-xs) 0 0;
  line-height: var(--app-line-height-normal);
  letter-spacing: var(--app-letter-spacing-normal);
}

/* 上传主区域 */
.upload-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* 上传区域样式 */
.upload-area::after {
  content: '';
  position: absolute;
  bottom: -15px;
  left: 5%;
  width: 90%;
  height: 10px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.03);
  filter: blur(5px);
  z-index: -1;
}

.upload-inner {
  padding: var(--app-spacing-xl) var(--app-spacing-lg);
}

:deep(.el-upload-dragger) {
  width: 100%;
  border-radius: var(--app-radius-md);
  border: 1px solid rgba(64, 158, 255, 0.3);
  transition: var(--app-transition-normal);
  padding: 0;
  overflow: hidden;
  position: relative;
  box-shadow:
    inset 0 2px 5px rgba(255, 255, 255, 0.8),
    0 2px 8px rgba(0, 0, 0, 0.03);
}

:deep(.el-upload-dragger:hover) {
  transform: translateY(-3px);
  box-shadow:
    inset 0 2px 5px rgba(255, 255, 255, 0.8),
    0 8px 15px rgba(0, 0, 0, 0.05);
  border-color: var(--el-color-primary);
}

:deep(.el-upload-dragger:hover)::before {
  opacity: 1;
}

:deep(.el-upload-dragger)::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--app-gradient-primary);
  opacity: 0;
  transition: var(--app-transition-normal);
}

:deep(.el-upload-dragger)::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(145deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: rotate(30deg);
  opacity: 0;
  transition:
    transform 0.8s ease,
    opacity 0.3s ease;
}

:deep(.el-upload-dragger:hover)::after {
  transform: rotate(30deg) translate(50%, 50%);
  opacity: 1;
}

.upload-icon {
  font-size: 32px;
  color: var(--el-color-primary);
  margin-bottom: var(--app-spacing-sm);
  filter: drop-shadow(0 0 3px rgba(var(--el-color-primary-rgb), 0.2));
  transition: var(--app-transition-normal);
}

:deep(.el-upload-dragger:hover) .upload-icon {
  transform: scale(1.1);
}

.upload-text {
  font-size: var(--app-font-size-base);
  color: var(--app-text-regular);
  margin-bottom: var(--app-spacing-sm);
  line-height: var(--app-line-height-normal);
  letter-spacing: var(--app-letter-spacing-normal);
}

.upload-text em {
  color: var(--el-color-primary);
  font-style: normal;
  font-weight: 600;
}

.upload-supported-types {
  display: flex;
  justify-content: center;
  gap: var(--app-spacing-md);
  flex-wrap: wrap;
  margin-top: var(--app-spacing-sm);
}

.file-type-item {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-xs);
  color: var(--app-text-secondary);
  font-size: var(--app-font-size-xs);
  letter-spacing: var(--app-letter-spacing-normal);
  background-color: rgba(var(--el-color-primary-rgb), 0.05);
  padding: var(--app-spacing-xs) var(--app-spacing-sm);
  border-radius: var(--app-radius-sm);
  border: 1px solid rgba(var(--el-color-primary-rgb), 0.08);
  transition: var(--app-transition-normal);
}

.file-type-item:hover {
  background-color: rgba(var(--el-color-primary-rgb), 0.08);
  transform: translateY(-2px);
  box-shadow: var(--app-shadow-light);
}

/* 上传提示样式 */
.upload-tips {
  margin-top: 20px;
  padding: 10px 15px;
  background-color: rgba(var(--el-color-info-rgb), 0.1);
  border-radius: var(--app-radius-md);
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.tip-item {
  display: flex;
  align-items: center;
  margin: 4px 0;
  color: var(--app-text-secondary);
  font-size: 14px;
}

.tip-icon {
  margin-right: 8px;
  font-size: 14px;
  color: var(--el-color-primary);
}

/* 功能区域 */
.features-section {
  padding: var(--app-spacing-sm) 0;
  position: relative;
  z-index: 1;
}

.features-title {
  font-size: var(--app-font-size-lg);
  margin-bottom: var(--app-spacing-lg);
  color: var(--app-text-primary);
  text-align: center;
  letter-spacing: var(--app-letter-spacing-tight);
  font-weight: 600;
  position: relative;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

.features-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--app-gradient-primary);
  opacity: 0.7;
  border-radius: var(--app-radius-sm);
}

.feature-card {
  display: flex;
  align-items: flex-start;
  gap: var(--app-spacing-md);
  padding: var(--app-spacing-md);
  border-radius: var(--app-radius-md);
  transition: var(--app-transition-normal);
  background: var(--app-gradient-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--app-border-color);
  box-shadow: var(--app-shadow-light);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.feature-card:hover {
  transform: translateY(-3px) translateX(2px);
  box-shadow: var(--app-shadow-hover);
  border-color: rgba(var(--el-color-primary-rgb), 0.1);
  z-index: 2;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--app-gradient-primary);
  opacity: 0.4;
  transition: opacity 0.3s ease;
}

.feature-card:hover::before {
  opacity: 1;
}

.feature-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--app-radius-sm);
  background-size: 18px;
  background-position: center;
  background-repeat: no-repeat;
  flex-shrink: 0;
  transition: var(--app-transition-normal);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.feature-card:hover .feature-icon {
  transform: scale(1.1);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.data-icon {
  background-color: var(--el-color-success-light-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2367C23A'%3E%3Cpath d='M4 5h16v2H4V5zm0 5h16v2H4v-2zm0 5h16v2H4v-2z'/%3E%3C/svg%3E");
}

.analysis-icon {
  background-color: var(--el-color-primary-light-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23409EFF'%3E%3Cpath d='M5 3v16h16v2H3V3h2zm15.293 3.293l1.414 1.414L16 13.414l-3-2.999-4.293 4.292-1.414-1.414L12 8.586l3 2.999 5.293-5.292z'/%3E%3C/svg%3E");
}

.insight-icon {
  background-color: var(--el-color-warning-light-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23E6A23C'%3E%3Cpath d='M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-2a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm0 4c-4.4 0-8-3.6-8-8s3.6-8 8-8 8 3.6 8 8-3.6 8-8 8zm0-2c3.3 0 6-2.7 6-6s-2.7-6-6-6-6 2.7-6 6 2.7 6 6 6zm0-8a2 2 0 1 1 0 4 2 2 0 0 1 0-4z'/%3E%3C/svg%3E");
}

.visual-icon {
  background-color: var(--el-color-danger-light-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23F56C6C'%3E%3Cpath d='M3 3h18v18H3V3zm2 2v14h14V5H5zm2 2h10v2H7V7zm0 4h10v2H7v-2zm0 4h5v2H7v-2z'/%3E%3C/svg%3E");
}

.feature-content h4 {
  font-size: var(--app-font-size-md);
  margin: 0 0 var(--app-spacing-xs);
  color: var(--app-text-primary);
  font-weight: 600;
  letter-spacing: var(--app-letter-spacing-tight);
}

.feature-content p {
  font-size: var(--app-font-size-sm);
  margin: 0;
  color: var(--app-text-regular);
  line-height: var(--app-line-height-normal);
  letter-spacing: var(--app-letter-spacing-normal);
}

/* 分析中动画 */
.analyzing-container {
  padding: var(--app-spacing-xxl) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--app-spacing-xl);
  min-height: 600px;
  justify-content: center;
}

/* 上传进度卡片 */
.upload-progress-card {
  background: var(--app-gradient-card);
  border: 1px solid var(--app-border-color);
  border-radius: var(--app-radius-lg);
  padding: var(--app-spacing-xxl);
  box-shadow: var(--app-shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--app-spacing-xl);
  max-width: 500px;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.upload-progress-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(64, 158, 255, 0.1), transparent);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* 环形进度指示器 */
.circular-progress {
  position: relative;
  width: 120px;
  height: 120px;
}

.progress-ring {
  transform: rotate(-90deg);
  filter: drop-shadow(0 0 10px rgba(64, 158, 255, 0.3));
}

.progress-ring-circle {
  transition: stroke-dasharray 0.35s ease;
}

.progress-ring-bg {
  stroke-dasharray: 327;
  stroke-dashoffset: 0;
}

.progress-ring-progress {
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 0.5s ease-in-out;
}

.progress-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 2;
}

.upload-icon-container {
  margin-bottom: 8px;
}

.upload-icon-animated {
  font-size: 32px;
  color: var(--el-color-primary);
  animation: uploadBounce 2s ease-in-out infinite;
}

@keyframes uploadBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.progress-percentage {
  font-size: 14px;
  font-weight: 600;
  color: var(--el-color-primary);
  animation: fadeInOut 2s ease-in-out infinite;
}

@keyframes fadeInOut {
  0%,
  100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

/* 状态区域 */
.status-section {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--app-spacing-md);
}

.analyzing-title {
  font-size: var(--app-font-size-lg);
  font-weight: 600;
  color: var(--app-text-primary);
  margin: 0;
}

.analyzing-animation {
  display: flex;
  gap: 15px;
  margin-bottom: var(--app-spacing-sm);
}

.analyzing-animation .circle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: var(--app-primary-regular);
  animation: bounce 1.4s infinite ease-in-out both;
}

.analyzing-animation .circle:nth-child(1) {
  animation-delay: -0.32s;
}

.analyzing-animation .circle:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.analyzing-text {
  font-size: var(--app-font-size-md);
  color: var(--app-text-secondary);
  font-weight: 400;
  letter-spacing: var(--app-letter-spacing-normal);
  margin: 0;
}

/* 处理步骤指示器 */
.processing-steps {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-md);
  margin: var(--app-spacing-lg) 0;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--app-spacing-xs);
  opacity: 0.4;
  transition: all 0.3s ease;
}

.step-item.active {
  opacity: 1;
}

.step-item.processing {
  opacity: 1;
  animation: stepPulse 2s ease-in-out infinite;
}

@keyframes stepPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.step-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--app-fill-light);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--app-border-color);
  transition: all 0.3s ease;
}

.step-item.active .step-icon {
  background: var(--el-color-primary);
  border-color: var(--el-color-primary);
  color: white;
}

.step-item.processing .step-icon {
  background: var(--el-color-warning);
  border-color: var(--el-color-warning);
  color: white;
  animation: iconRotate 2s linear infinite;
}

@keyframes iconRotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.step-text {
  font-size: var(--app-font-size-sm);
  color: var(--app-text-secondary);
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
}

.step-item.active .step-text {
  color: var(--el-color-primary);
  font-weight: 600;
}

.step-item.processing .step-text {
  color: var(--el-color-warning);
  font-weight: 600;
}

.step-connector {
  width: 40px;
  height: 2px;
  background: var(--app-border-color);
  transition: all 0.3s ease;
}

.step-connector.active {
  background: var(--el-color-primary);
}

/* 上传提示卡片 */
.upload-tips-card {
  background: var(--app-fill-light);
  border-radius: var(--app-radius-md);
  padding: var(--app-spacing-lg);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--app-spacing-sm);
}

.upload-tips-card .tip-item {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-sm);
  font-size: var(--app-font-size-sm);
  color: var(--app-text-secondary);
}

.upload-tips-card .tip-icon {
  color: var(--el-color-info);
  font-size: 16px;
  flex-shrink: 0;
}

/* 移除旧的进度条样式 */
.progress-bar {
  width: 300px;
  height: 4px;
  background-color: var(--app-fill-light);
  border-radius: var(--app-radius-sm);
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.progress-inner {
  position: absolute;
  height: 100%;
  width: 30%;
  background: var(--app-gradient-primary);
  border-radius: var(--app-radius-sm);
  animation: progress 2s infinite ease-in-out;
  box-shadow: 0 1px 3px rgba(var(--el-color-primary-rgb), 0.3);
}

@keyframes progress {
  0% {
    left: -30%;
  }
  100% {
    left: 100%;
  }
}

/* 响应式设计 */
@media (max-width: 992px) {
  .tab-content {
    flex-direction: column;
  }

  .content-row {
    padding: var(--app-spacing-lg) 0;
  }

  .upload-top,
  .dataset-left {
    padding-bottom: var(--app-spacing-xl);
  }

  .upload-bottom,
  .dataset-right {
    padding-top: var(--app-spacing-xl);
  }

  .upload-right::before,
  .dataset-right::before {
    display: none;
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* 在中等屏幕上改为两列布局 */
  .dataset-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .upload-content {
    padding: var(--app-spacing-md);
  }

  .upload-layout {
    min-height: auto;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  /* 在小屏幕上改为单列布局 */
  .dataset-cards {
    grid-template-columns: 1fr;
  }

  .tabs-container {
    flex-direction: column;
    gap: var(--app-spacing-sm);
  }

  .tab-item.active::after {
    display: none;
  }

  .upload-footer {
    flex-direction: column;
    gap: var(--app-spacing-sm);
    align-items: flex-start;
  }

  .help-text {
    margin-top: var(--app-spacing-xs);
  }

  .app-title {
    font-size: var(--app-font-size-xl);
  }

  .app-desc {
    font-size: var(--app-font-size-sm);
  }

  .upload-area,
  .upload-tips,
  .upload-footer {
    max-width: 100%;
  }

  .upload-inner {
    padding: var(--app-spacing-lg) var(--app-spacing-md);
  }

  .back-button {
    top: var(--app-spacing-md);
    left: var(--app-spacing-md);
  }

  /* 在小屏幕上按钮垂直排列 */
  .buttons-container {
    flex-direction: column;
    gap: var(--app-spacing-sm);
  }

  .back-btn,
  .create-btn {
    width: 100% !important;
  }
}

/* 响应式：小屏幕时改为一列显示 */
@media (max-width: 550px) {
  .upload-tips {
    grid-template-columns: 1fr;
  }
}
</style>
